package com.xiaoye.digitaltwin.service.impl;

import com.xiaoye.digitaltwin.entity.Baopo;
import com.xiaoye.digitaltwin.mapper.BaopoMapper;
import com.xiaoye.digitaltwin.service.BaopoService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 爆破实验表 服务实现类
 * </p>
 *
 * @author xiaoye
 * @since 2023-04-01
 */
@Service
public class BaopoServiceImpl extends ServiceImpl<BaopoMapper, Baopo> implements BaopoService {

    @Override
    public String check(Baopo baopo){
        if (baopo.getStress() == null) {
            return "压力不能为空";
        }
        if (baopo.getOuterDiameter1() == null || baopo.getOuterDiameter2() == null || baopo.getOuterDiameter3() == null) {
            return "外径不能为空";
        }
        if (baopo.getWallThick1() == null || baopo.getWallThick2() == null || baopo.getWallThick3() == null) {
            return "壁厚不能为空";
        }

        if(baopo.getOuterDiameter1() < 45.0 || baopo.getOuterDiameter1()> 46.0){
            return "外径值1不再规定范围";
        }
        if(baopo.getOuterDiameter2() < 45.0 || baopo.getOuterDiameter2()> 46.0){
            return "外径值2不再规定范围";
        }
        if(baopo.getOuterDiameter3() < 45.0 || baopo.getOuterDiameter3()> 46.0){
            return "外径值3不再规定范围";
        }

        if(baopo.getWallThick1() < 3.80 || baopo.getWallThick1() > 3.90){
            return "壁厚值1不再规定范围";
        }
        if(baopo.getWallThick2() < 3.80 || baopo.getWallThick2() > 3.90){
            return "壁厚值2不再规定范围";
        }
        if(baopo.getWallThick3() < 3.80 || baopo.getWallThick3() > 3.90){
            return "壁厚值3不再规定范围";
        }

        return "通过";
    }

}
